package com.example.mybatisplus.pojo;

import com.baomidou.mybatisplus.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.util.Date;

@AllArgsConstructor
@NoArgsConstructor
@Data
@TableName("general")
@Accessors(chain = true)
public class General {
    //注意：数据库表要开启主键自动增长
    @TableId(type = IdType.AUTO)
    private Integer id;
    private String name;
    private Date createTime;
    @Version
    //由于插入的时候是不会给version版本号赋值的，但没有值会报错，所以需要自动填充该值
    @TableField(fill = FieldFill.INSERT)
    private Long version;
    /**
     * @TableLogic(value = "null",delval = "1")//数字的复杂类型
     * private Integer deleted;
     * @TableLogic(delval = "now()", value = "null")//时间类型
     * private LocalDateTime delTime;
     */
    @TableLogic(value = "false",delval = "true")
    @TableField(fill = FieldFill.INSERT)
    private boolean logicDeleteState;
    public General(String name,Date createTime){
        this.name=name;
        this.createTime=createTime;
    }
    public General test(String name,int age){
        return null;
    }
}
